import service from '@/core/net/request'

export function getImageList(id, page = 1) {
  return service.get(`/api/admin/image_class/${id}/image/${page}`)
}

export function updateImage(id, name) {
  return service.post(`/api/admin/image/${id}`, { name })
}

export function deleteImage(ids) {
  return service.post(`/api/admin/image/delete_all`, { ids })
}

export const uploadImageAction = '/api/admin/image/upload'

// ImageAside
export function getImageClassList(page) {
  return service.get('/api/admin/image_class/' + page)
}

export function createImageClass(data) {
  return service.post('/api/admin/image_class', data)
}

export function updateImageClass(id, data) {
  return service.post('/api/admin/image_class/' + id, data)
}

export function deleteImageClass(id) {
  return service.post(`/api/admin/image_class/${id}/delete`)
}
